package com.zmt.xuechengplusbase.model;

import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

/**
 * 分页结果
 */
@Data
@ToString
public class PageResult<T> implements Serializable {

    private List<T> items;

    private  long counts;

    private PageParams pageParams;

    private long page;

    private long pageSize;
//
//    public PageResult(List<T> items, long counts, long page, long pageSize) {
//        this.items = items;
//        this.counts = counts;
//        this.page = page;
//        this.pageSize = pageSize;
//    }

    public PageResult(List<T> items) {
        this.items = items;
    }

    public PageResult(List<T> items, long counts, PageParams pageParams) {
        this.items = items;
        this.counts = counts;
        this.page = pageParams.getPageNo();
        this.pageSize = pageParams.getPageSize();
    }
}
